package cn.tedu.blog.server.controller.api;

import cn.tedu.blog.server.service.IFavoritrService;
import cn.tedu.blog.server.utils.JsonResult;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(tags = "1.个人文章收藏模块")
@RequestMapping("/favorites")
public class ApiFavoriteController {

    @Autowired
    private IFavoritrService favoritrService;

    @ApiOperation("查询用户发表收藏的文章数")
    @ApiOperationSupport(order = 100)
    @GetMapping("/countByUserId")
    public JsonResult countCollectionArticle(){
        log.info("查询用户收藏的文章数");
        int pagSize = favoritrService.favoriteCountByUserId();
        return JsonResult.ok(pagSize);
    }
}
